﻿using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _10_04Prism直接调用模块.ViewModels
{
    class MainViewModel: BindableBase
	{
		public readonly IRegionManager regionManager;
		public DelegateCommand<string> OpenCommand { get; private set; }

		public MainViewModel(IRegionManager regionManager)
		{
			OpenCommand = new DelegateCommand<string>(Open);
			this.regionManager = regionManager;
		}

		private void Open(string obj)
		{
			NavigationParameters keys = new NavigationParameters();
			keys.Add("Title", "Hello");


			//通过IRegionManager接口获取当前全局定义可用区域
			//往这个区域动态的去设置内容
			//设置内容的方式是通过依赖注入的形式
			regionManager.Regions["ContentRegion"].RequestNavigate(obj);
		}
	}

}
